<%@ include file="/common/taglibs2.jsp"%>

<sql:setDataSource var="db" url="jdbc:hsqldb:db/menu"
    driver="org.hsqldb.jdbcDriver" user="sa" password=""/>

<sql:transaction dataSource="${db}">

    <sql:update>
        DROP TABLE menu_item IF EXISTS
    </sql:update>
    <sql:update>
        CREATE TABLE menu_item (
           id BIGINT not null,
           parent_name VARCHAR(30),
           name VARCHAR(30),
           title VARCHAR(30),
           description VARCHAR(50),
           location VARCHAR(255),
           target VARCHAR(10),
           onclick VARCHAR(100),
           onmouseover VARCHAR(100),
           onmouseout VARCHAR(100),
           image VARCHAR(50),
           altImage VARCHAR(30),
           tooltip VARCHAR(100),
           roles VARCHAR(100),
           page VARCHAR(255),
           width VARCHAR(5),
           height VARCHAR(5),
           forward VARCHAR(50),
           action VARCHAR(50),
           primary key (id)
        )
    </sql:update>

    <sql:update var="updateCount">
        INSERT INTO menu_item (id, name, title) VALUES (1,'DatabaseMenu','Database Menu')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (2,'DatabaseMenu','Yahoo','Yahoo2 Mail','http://mail.yahoo.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (3,'DatabaseMenu','JavaBlogs','JavaBlogs','http://javablogs.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (5,'DatabaseMenu','JavaBlogs','JavaBlogs5','http://javablogs.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (6,'DatabaseMenu','JavaBlogs','JavaBlogs6','http://javablogs.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (7,'DatabaseMenu','JavaBlogs','JavaBlogs7','http://javablogs.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (8,'DatabaseMenu','JavaBlogs','JavaBlogs8','http://javablogs.com')
    </sql:update>
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, parent_name, name, title, location)
        VALUES (9,'DatabaseMenu','JavaBlogs','JavaBlogs9','http://javablogs.com')
    </sql:update>                    
    <sql:update var="updateCount">
        INSERT INTO menu_item (id, name, title, location)
        VALUES (4,'StandaloneMenu','Standalone Menu','http://raibledesigns.com')
    </sql:update>
    <sql:query var="menus">
        SELECT * FROM menu_item order by id;
    </sql:query>

</sql:transaction>